<!DOCTYPE html>
<html lang="en">
<head>
    {include file="common/meta_new" /}
    <script src="/assets/js2/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/receivingAddressPage.css">
</head>
<body class="F6">
<div id="app" class="receiving-address-page">
    <!-- header -->
    <div class="header">
        <div class="header-height"></div>
        <div class="header-wrap">
            <div class="header-content">
                <div class="left">
                    <a href="{:url('index/user/index');}"><div class="go-back"><img src="/static/images/go-back.png" alt=""></div></a>
                    <div class="text">收货地址</div>
                </div>
                <div class="title"></div>
            </div>
        </div>
    </div>
{eq name="hasAddr" value="1"}
    <div class="group">
        <div class="top">
            <div class="tips">默认</div>
            <div class="text">{$addr['province_city_area']}</div>
        </div>
        <div class="center">{$addr['address']}</div>
        <div class="btm">{$addr['consignee']}  {$addr['phone']|hidtelphone}</div>
    </div>
{else/}
    <br/>
{/eq}


    <div class="inputGroup">
        <div class="cell">
            <div class="label">收货人</div>
            <input id="consignee" type="text" placeholder="请填写收货人姓名">
        </div>
        <div class="cell">
            <div class="label">手机号码</div>
            <input id="phone" type="text" placeholder="请填写收货人手机号">
        </div>
        <div class="cell">
            <div class="label">所在地区</div>
            <input id="province_city_area" type="text" placeholder="请填写省市区">
        </div>
        <div class="cell">
            <div class="label">详细地址</div>
            <input id="address" type="text" placeholder="请填写街道、楼牌号等">
        </div>
    </div>

<button onclick="save()" class="btn">修改</button>
</div>
<script src="/static/js/common.js"></script>
<script>
    function save(){
        var consignee = $("#consignee").val();
        var phone = $("#phone").val();
        var province_city_area = $("#province_city_area").val();
        var address = $("#address").val();
        
        $.post("{:url('index/user/myaddress')}",{"consignee":consignee,'phone':phone,"address":address,"province_city_area":province_city_area},function(ret){
                layer.msg(ret.msg,{icon:1,time:3000,shade:0.4},function() {
                    if(ret.code==1){
                    location.reload();
                    }
                });
        });
    }
</script>

</body>
</html>